import { HTTP } from 'utils/http';
import config from 'utils/config';

class IndexModel extends HTTP {
  getHomeDatas(cityId) {
    return new Promise((resolve, reject) => {
      // this指向的是当前类IndexModel，且IndexModel又是继承于HTTP的
      this.axiosPost({
        url: config.API.GET_HOME_DATAS,
        data: {
          cityId
        },
        success(data) {
          resolve({
            data,
            status: 0
          });
        },
        error(error) {
          resolve({
            error,
            status: -1
          });
        }
      });
    });
  }
}


export { IndexModel };